// pages/huodongxiangqing/huodongxiangqing.js
var request = require('../../utils/request.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    act_id:'',
    img: 'https://zgg.chuangkegf.com'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var that = this;
      var act_id = options.id;
      that.setData({
        act_id: options.id
      });
      that.getData();
  },
  getData: function () {
    var that = this;
    var url = request.dataUrl + '/Orchard/activity_detail';
    var params = {
      act_id: that.data.act_id
    }
    request.requestLoading(url, params, '正在加载数据', function (res) {
      console.log(res)
      that.setData({
        act_banner: res.data.act_banner,
        act_address: res.data.act_address,
        act_bg: res.data.act_bg,
        act_name: res.data.act_name,
        act_user: res.data.act_user,
        act_content: res.data.act_content,
        act_img: res.data.act_img,
        act_phone: res.data.act_phone,
        act_time: res.data.act_time
      })
    }, function (res) {
      wx.showToast({
        title: '加载数据失败',
        image: '../../image/fail.png'
      })
    })

  },
  // 拨打电话
  phone: function (e) {
    var that = this
    wx.makePhoneCall({
      phoneNumber: that.data.act_phone //仅为示例，并非真实的电话号码
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})